require('shelljs/global');
const {run} = require('./cmd');

/**
 * 打包
 */
function packagea(config,opt,pms) {
  const cmd = config.getBuildCmd(opt.env);
  if(!cmd || cmd.length == 0){
    console.error('没有执行的命令！');
    exit(1);
  }
  for(const cd of cmd){
    const rtn = run(cd);
    if(1 == rtn.code){
      console.error(rtn.stderr || '打包失败');
      exit(1);
    }
  }
}


module.exports = {
  package: packagea
};
